/*************************************************************************
	> File Name: P10483.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2024-12-17 09:22:51
 ************************************************************************/
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int n, W, ans = INT32_MAX;
int car[20];
int arr[20];

void dfs(int m, int cnt) {
    if (m == n) {
        ans = min(ans, cnt);
        return ;
    }
    if (cnt >= ans) return ;
    for (int i = 1; i <= cnt; i++) {
        if (car[i] < arr[m]) continue;
        car[i] -= arr[m];
        dfs(m + 1, cnt);
        car[i] += arr[m];
    }
    car[cnt + 1] -= arr[m];
    dfs(m + 1, cnt + 1);
    car[cnt + 1] += arr[m];
    return ;
}

int main() {
    cin >> n >> W;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    for (int i = 1; i <= n; i++) {
        car[i] = W;
    }
    sort(arr, arr + n, greater<int>());
    dfs(0, 1);
    cout << ans << endl;
    return 0;
}
